package com.jcl.recruit.basic.register.impl;

import com.jcl.recruit.basic.register.RegisterCallback;
import com.jcl.recruit.basic.register.model.RegisterEnum;
import com.jcl.recruit.basic.register.model.RegisterResult;
import com.jcl.recruit.basic.register.vo.RegisterVo;
import com.jcl.recruit.console.ConsoleCorpDao;
import com.jcl.recruit.console.ConsoleUserAccessDao;
import com.jcl.recruit.console.model.ConsoleCorpInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @ClassName RegisterCallbackImpl

 * @Author yyliu
 * @Date 2018/12/17 14:29
 * @Version 1.0
 **/

@Component("registerCallback")
public class RegisterCallbackImpl implements RegisterCallback {

    @Autowired
    private ConsoleUserAccessDao consoleUserAccessDao;

    @Autowired
    private ConsoleCorpDao consoleCorpDao;


    @Override
    public void registerCorp(RegisterEnum registerEnum,
                             RegisterVo vo,
                             RegisterResult result) {

        this.refreshConsoleCorpInfo(result.getConsoleCorpInfo(), result.getUserId());

        if (registerEnum.equals(RegisterEnum.BASIC)) {

        } else if (registerEnum.equals(RegisterEnum.WECHAT)) {

        }
    }

    public void refreshConsoleCorpInfo(ConsoleCorpInfo corpInfo, Integer userId) {

        corpInfo.setAddUser(userId);
        consoleCorpDao.updateByPrimaryKey(corpInfo);


    }
}
